package tech.threekilogram.activitytasktest;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;

/**
 * @author liujin
 */
public class MainActivity extends AppCompatActivity {

      private static final String TAG = MainActivity.class.getSimpleName();

      @Override
      protected void onCreate ( Bundle savedInstanceState ) {

            super.onCreate( savedInstanceState );
            setContentView( R.layout.activity_main );

            Log.e( TAG, "onCreate : " + Util.getTask( this ) );
      }

      @Override
      protected void onDestroy ( ) {

            super.onDestroy();
            Log.e( TAG, "onDestroy : " + this );
      }

      public void toStand ( View view ) {

            StandActivity.start( this );
      }

      public void toSingleTop ( View view ) {

            SingleTopActivity.start( this );
      }

      public void toSingleTask ( View view ) {

            SingleTaskActivity.start( this );
      }

      public void toSingleInstance ( View view ) {

            SingleInstanceActivity.start( this );
      }

      public void standNewTask ( View view ) {

            Intent intent = new Intent( this, StandActivity.class );
            intent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
            startActivity( intent );
      }

      public void flagSingleTop ( View view ) {

            Intent intent = new Intent( this, MainActivity.class );
            intent.setFlags( Intent.FLAG_ACTIVITY_SINGLE_TOP );
            startActivity( intent );
      }

      public void flagClearTop ( View view ) {

            ClearTopActivity.start( this );
      }

      public void flagClearTask ( View view ) {

            ClearTaskActivity.start( this );
      }
}
